package com.jaydenxiao.common.baseapp;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;

/**
 * Created by hasee on 2017/10/27.
 */

public class RequestUtil {


    public static List<MultipartBody.Part> getFileBodys(List<File> files, String name){

        List<MultipartBody.Part> bodys=new ArrayList<>();
        for (int i=0;i<files.size();i++){
            RequestBody imageBody = RequestBody.create(MediaType.parse("multipart/form-data"), files.get(i));
            MultipartBody.Part body=MultipartBody.Part.createFormData(name,files.get(i).getName(),imageBody);
            bodys.add(body);
        }
        return bodys;
    }




}
